<?php

class HomeController extends Zend_Controller_Action
{
    public function init()
    {
        parent::init();

        if (Zend_Auth::getInstance()->hasIdentity())
        {
            $user = Zend_Auth::getInstance()->getIdentity();

            $this->view->userProfile = $user->profile;
            $this->view->user = $user;
        }
        else
            $this->_redirect('/index');
    }

    public function indexAction()
    {
        $this->view->wall = Wall::findOneByLoggedUser();
        $this->view->publications = Publication::findAllByEntity($this->view->wall->object->id, 'DESC');
    }
}
